package com.zp.callback;

import com.zp.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;

/**
 * 服务下线
 */
public class CloseCallbackImpl implements ApplicationListener<ContextClosedEvent> {
    @Autowired
    private RegisterService registerService;
    @Override
    public void onApplicationEvent(ContextClosedEvent contextClosedEvent) {
        registerService.remove();
    }
}
